(function () {
    'use strict';
    angular.module('module.business')
        .controller('RectificationNoticeController', RectificationNoticeController);
    RectificationNoticeController.$inject = ['$rootScope', '$scope', '$filter', '$uibModal', '$http', '$state', 'i18nService'];

    function RectificationNoticeController($rootScope, $scope, $filter, $uibModal, $http, $state, i18nService) {
        var vm = $scope;
        vm.exportNum=null;
        vm.export1Num=null;
        vm.activate = activate;     //初始化
        vm.loadTable = loadTable;//加载列表
        vm.create=create;


        vm.gridOptions = {
            multiSelect: true,                                           //多选
            enableRowSelection: true,                                  //允许选中行
            //showGridFooter:true,
            enableRowHeaderSelection: false,//允许通过点击行首选中行
            enableColumnResizing : true,//设置宽度
            enableGridMenu: true,
            enableFullRowSelection: true,                              //允许通过点击行任意位置选中行
            modifierKeysToMultiSelect: true,                           //只允许通过键盘辅助多选(前提是允许多选)
            paginationPageSize: 10,
            paginationPageSizes: [10, 20, 50]

        };
        i18nService.setCurrentLang('zh-cn');
        vm.gridOptions.onRegisterApi = onRegisterApi;
        vm.gridOptions.columnDefs = [
            {field: 'NUMBER', visible: true, name: '序号', pinnedLeft: true,cellTooltip: true,headerTooltip: true,width:'80'},
            {field: 'WORD_NO', visible: true, name: '文号', pinnedLeft: true,cellTooltip: true,headerTooltip: true,width:'180'},
            {field: 'UNIT', visible: true, name: '单位名称', pinnedLeft: true,cellTooltip: true,headerTooltip: true},
            {field: 'DEADLINE', visible: true, name: '整改截止日期', pinnedLeft: true,cellTooltip: true,headerTooltip: true,width:'150'},
            {field: 'CREATE_MAN', visible: true, name: '创建人', pinnedLeft: true,cellTooltip: true,headerTooltip: true,width:'100'},
            {field: 'CREATE_DATE', visible: true, name: '创建时间', pinnedLeft: true,cellTooltip: true,headerTooltip: true,width:'150'},
            {field: 'IS_NOTICE', visible: true, name: '是否已通知', pinnedLeft: true,cellTooltip: true,headerTooltip: true,width:'200'}
        ];
        activate();
        return vm;





        function create() {
            var  modalInstance= $uibModal.open({
                animation: true,
                ariaLabelledBy: 'modal-title',
                ariaDescribedBy: 'modal-body',
                templateUrl: 'createRectificationNotice.html',
                controller: 'CreateRectificationNoticeController',
                controllerAs: 'create',
                size: 'lg'
            });
            modalInstance.result.then(function () {
            }, function () {
            });
        }






        function onRegisterApi(gridApi) {
            //set gridApi on scope
            vm.gridApi = gridApi;
        }
        function activate(){
            $scope.$on('$viewContentLoaded', function () {
                App.initAjax(); // initialize core components
            });
            $rootScope.settings.layout.pageContentWhite = true;
            $rootScope.settings.layout.pageBodySolid = true;
            $rootScope.settings.layout.pageSidebarClosed = false;
            loadTable();
        }

        function loadTable(){
            $http.get('app/module/business/rectification/notice/notice.json')
                .then(function(data){
                    vm.gridOptions.data = data.data.record;
                });
        }




    }
})();